class Solution
{
public:
    bool findRotation(vector<vector<int>> &mat, vector<vector<int>> &target)
    {
        int n = mat.size();
        if (mat == target)
        {
            return true;
        }
        for (int i = 0; i < 3; ++i)
        {
            for (int x = 0; x < n / 2; ++x)
            {
                for (int y = 0; y < (n + 1) / 2; ++y)
                {
                    int temp = mat[x][y];
                    mat[x][y] = mat[n - y - 1][x];
                    mat[n - y - 1][x] = mat[n - x - 1][n - y - 1];
                    mat[n - x - 1][n - y - 1] = mat[y][n - x - 1];
                    mat[y][n - x - 1] = temp;
                }
            }
            if (mat == target)
            {
                return true;
            }
        }
        return false;
    }
};